package com.sky.web.admin;

import com.sky.result.Result;
import com.sky.service.ReportService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@Slf4j
@RequestMapping("/admin/workspace")
public class WorkSpaceController {

    @Autowired
    private ReportService reportService;

    // 查询工作台  今日数据
    @GetMapping("/businessData")
    public Result businessData() {
        // 获取当前日期
        LocalDate today = LocalDate.now();
        // 调用service
        BusinessDataVO businessDataVO = reportService.getBusinessData(today);
        return Result.success(businessDataVO);
    }

    // 查询工作台  今日订单
    @GetMapping("/overviewOrders")
    public Result overviewOrders() {
        // 调用service
        OrderOverViewVO orderOverViewVO = reportService.overviewOrders();
        return Result.success(orderOverViewVO);
    }

    // 查询工作台  查询菜品总览
    @GetMapping("/overviewDishes")
    public Result overviewDishes() {
        // 调用service
        DishOverViewVO dishOverViewVO = reportService.overviewDishes();
        return Result.success(dishOverViewVO);
    }



    // 查询工作台  查询套餐总览
    @GetMapping("/overviewSetmeals")
    public Result overviewSetmeals(){
        SetmealOverViewVO setmealOverViewVO = reportService.overviewSetmeals();
        return Result.success(setmealOverViewVO);
    }
}

